package br.com.alinesoftware.app.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.ForeignKey;

@MappedSuperclass
public abstract class ContratoGarcom implements Serializable {

	private static final long serialVersionUID = 6889806493671551806L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SE_CONTRATO_GARCOM")
	@Column(nullable = false, length = 5)
	private Long id;

	@ManyToOne(targetEntity = EstabelecimentoEntity.class, fetch = FetchType.LAZY)
	@ForeignKey(name = "FK_CONTRGARCOM_ESTAB")
	@NotNull
	@JoinColumn
	private Estabelecimento estabelecimento;

	@ManyToOne(targetEntity = GarcomFreeLancerEntity.class, fetch = FetchType.LAZY)
	@ForeignKey(name = "FK_CONTGARCOM_GARCOM")
	@NotNull
	@JoinColumn
	private GarcomFreeLancer garcomFreeLancer;

	@NotNull
	@Column(length = 11)
	@Temporal(TemporalType.TIMESTAMP)
	private Date dataInicio;

	@NotNull
	@Column(length = 11)
	@Temporal(TemporalType.TIMESTAMP)
	private Date dataTermino;

	@NotNull
	@Column
	private Boolean ativo;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Estabelecimento getEstabelecimento() {
		return estabelecimento;
	}

	public void setEstabelecimento(Estabelecimento estabelecimento) {
		this.estabelecimento = estabelecimento;
	}

	public GarcomFreeLancer getGarcomFreeLancer() {
		return garcomFreeLancer;
	}

	public void setGarcomFreeLancer(GarcomFreeLancer garcomFreeLancer) {
		this.garcomFreeLancer = garcomFreeLancer;
	}

	public Date getDataInicio() {
		return dataInicio;
	}

	public void setDataInicio(Date dataInicio) {
		this.dataInicio = dataInicio;
	}

	public Date getDataTermino() {
		return dataTermino;
	}

	public void setDataTermino(Date dataTermino) {
		this.dataTermino = dataTermino;
	}

	public Boolean getAtivo() {
		return ativo;
	}

	public void setAtivo(Boolean ativo) {
		this.ativo = ativo;
	}

}
